#include<stdio.h>
int i,x,y,c,m,n;
int main(){
    FILE *fp=fopen("ENTRIES.INP","r");
    FILE *out=fopen("BIN.INP","w");
    fscanf(fp,"%d%d",&n,&m);
    fprintf(out,"%d",m);
    for(i=1;i<=m;i++){
        fscanf(fp,"%d%c%d",&x,&c,&y);
        fprintf(out,"\n%d %d %d",x,y,c=='+'?1:2);
    }
    fclose(out);
    fclose(fp);
    return 0;
}
